package books.borrowing.bo.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import books.borrowing.bo.ISubscriberBo;
import books.borrowing.dao.impl.SubscriberDao;
import books.borrowing.entity.SubscriberEntity;

@Service("subscriberBo")
public class SubscriberBoImpl implements ISubscriberBo {

	@Autowired
	SubscriberDao subDao;

	public void setSubscriberDao(SubscriberDao _subDao) {
		this.subDao = _subDao;
	}

	public void save(SubscriberEntity _sub) {
		this.subDao.save(_sub);
	}

	public void update(SubscriberEntity _sub) {
		this.subDao.update(_sub);
	}

	public void delete(SubscriberEntity _sub) {
		this.subDao.delete(_sub);
	}

	public SubscriberEntity connect(String _login, String _password)
			throws Exception {
		return this.subDao.connect(_login, _password);
	}

	@Transactional(readOnly = true)
	public SubscriberEntity findSubscriberByLogin(String _login)
			throws Exception {
		return this.subDao.findSubscriberByLogin(_login);
	}

}
